package com.zmx.b2c.order.messaging.queue;

import com.zmx.common.common.contents.MqQueueContents;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description: 删除订单缓存队列
 * @ClassName: DeleteOrderCacheQuue
 * @Author zhaomxr
 * @Date 2021-10-25 16:55
 */
@Configuration
public class OrderCacheQueue {

    @Bean("deleteOrderCacheQueue")
    public Queue deleteOrderCacheQueue() {
        return new Queue(MqQueueContents.DELETE_ORDERCACHE_QUEUE);
    }

    @Bean("deleteOrderCacheExchange")
    public FanoutExchange deleteOrderCacheExchange() {
        return new FanoutExchange(MqQueueContents.DELETE_ORDERCACHE_EXCHANGE, true, false, null);
    }

    @Bean
    public Binding deleteOrderCacheBinding1(@Qualifier("deleteOrderCacheQueue") Queue queue, @Qualifier("deleteOrderCacheExchange") FanoutExchange exchange) {
        return BindingBuilder.bind(queue).to(exchange);
    }

}
